<template>
  <div class="property-selectModel">
      <Form :model="data" :label-width="90" label-position="right">
        <FieldItem
          v-model="data.modelType" :config="{type: 'select', options: compGroup.getModelTypeList}" @change="changeType"
          :formItemProps="{label: $t(`compDesign.jProperty.modelType`), prop: data.modelType, }"
        />
        <FieldItem
          v-model="data.model" :config="{type: 'cascader', data: compGroup.getModelTree(modelSource)}" @change="changeTree"
          :formItemProps="{label: $t(`compDesign.jProperty.model`), prop: data.model, }"
        />
      </Form>
    <!-- <starLabel style="grid-area: a">{{ $t(`compDesign.jProperty.model`) }}</starLabel>
    <Cascader v-model="compGroup.currentItem.property['cliContainerTable'].model"
    transfer-class-name="model-dropdownwp"
    :data="compGroup.getModelTree('container')" transfer @on-change="changeTree"></Cascader> -->
  </div>
</template>

<script>
    import storeVar from '../config/mixins/storeVar';
    import {mapActions, mapState} from "vuex";

    export default {
        name: 'jPropertySelectModel',
        components: {  },
        mixins: [storeVar],
        data () {
            return {
            }
        },
        props: {
            data: {
                default() {
                    return {}
                }
            },
            modelSource: {
                default() {
                    return 'entity' // entity,container
                }
            },
        },
        watch: {
            'compGroup.currentId': {
            }
        },
        methods: {
            changeType(val) {
                console.log("file: selectModel.vue:43  changeType  data:", this.data)
            },
            changeTree (model, data) {
                if (this.tools.testType(model) !== 'array') {
                    this.modelValue = [];
                }
                this.compGroup.currentClassObject.setModel(model);
                this.syncGroup();
            },
        }
    }
</script>
